package com.jiazhong.spring.ioc.annotation;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class App {

    private static void a(){
        // 扫描具体的包
        ApplicationContext context = new AnnotationConfigApplicationContext("com.jiazhong.spring.ioc.annotation");
        // 获取到对象
        DemoA a = context.getBean(DemoA.class);
        System.out.println(a);
    }
    private static void b(){
        // 扫描具体的包
        ApplicationContext context = new AnnotationConfigApplicationContext("com.jiazhong.spring.ioc.annotation");
        // 获取到对象
        DemoB a1 = context.getBean("db",DemoB.class);
        DemoB a2 = context.getBean("db",DemoB.class);
        System.out.println(a1);
        System.out.println(a2);
    }

    private static void c(){
        // 扫描具体的包
        ApplicationContext context = new AnnotationConfigApplicationContext("com.jiazhong.spring.ioc.annotation");
        // 获取到对象
        DemoC c = context.getBean("demoC",DemoC.class);
        System.out.println(c);
    }

    private static void d1(){
        // 扫描具体的包
        ApplicationContext context = new AnnotationConfigApplicationContext("com.jiazhong.spring.ioc.annotation");
        // 获取到对象
        DemoD d = context.getBean(DemoD.class);
        System.out.println(d);
    }
    private static void d2(){
        // 扫描具体的包
        ApplicationContext context = new AnnotationConfigApplicationContext("com.jiazhong.spring.ioc.annotation");
        // 获取到对象
        DemoD4 d = context.getBean(DemoD4.class);
        System.out.println(d);
    }


    private static void e1(){
        ApplicationContext context = new AnnotationConfigApplicationContext("com.jiazhong.spring.ioc.annotation");
        DemoE1 d = context.getBean(DemoE1.class);
        System.out.println(d);
    }


    private static void e2(){
        ApplicationContext context = new AnnotationConfigApplicationContext("com.jiazhong.spring.ioc.annotation");
        DemoE2 d = context.getBean(DemoE2.class);
        System.out.println(d);
    }
    public static void main(String[] args) {
        e2();
    }
}
